<template>
  <el-dialog :title="'单项奖惩查看'" :close-on-click-modal="false" :visible.sync="visible"
             @close="clearDataList()" width="80%" top="8vh">

    <el-table :data="dataList" stripe width="99%" border class="avue-crud mb10">
      <el-table-column type="index" width="80" header-align="center" align="center" label="序号"></el-table-column>
      <el-table-column prop="userCode" header-align="center" align="center" label="人员编号"></el-table-column>
      <el-table-column prop="userName" header-align="center" align="center" label="人员姓名"></el-table-column>
      <el-table-column prop="lx" header-align="center" align="center" label="类型"></el-table-column>
      <el-table-column prop="jjxName" header-align="center" align="center" label="奖金项名称"></el-table-column>
      <el-table-column prop="jjJe" header-align="center" align="center" label="奖惩金额"></el-table-column>
      <el-table-column prop="jjDate" header-align="center" align="center" label="奖惩时间" width="180"></el-table-column>
      <el-table-column prop="jjFfzt" header-align="center" align="center" label="发放状态"></el-table-column>
      <el-table-column prop="jjSm" header-align="center" align="center" show-overflow-tooltip min-width="300" label="奖惩说明"></el-table-column>
    </el-table>

    <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
                   :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" background
                   layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    <span slot="footer" class="dialog-footer">
        <el-button @click="clearDataList" type="primary" plain>取消</el-button>
    </span>

  </el-dialog>
</template>

<script>
/*!
 * 单项奖惩查看
 *
 * @author lxl
 * @date 2021-9-3 09:43:47
 */
import {fetchList} from '@/api/jiangjin/jiangjingrjcjlb';

export default {
  data(){
    return{
      visible:false,
      dataList:[],
      dataForm:{
        userCode:'',
      },
      //翻页
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
    }
  },
  methods:{
    //初始化
    init(code){
      this.visible=true;
      this.dataForm.userCode=code;
      this.getDataList();
    },
    //获得数据
    getDataList(){
      fetchList(Object.assign({
        current: this.pageIndex,
        size: this.pageSize
      },this.dataForm))
        .then((res)=>{
          this.dataList=res.data.data.records;
          this.totalPage = res.data.data.total;
        })
    },
    //取消
    clearDataList(){
      this.visible = false;
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val;
      this.pageIndex = 1;
      this.getDataList();
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val;
      this.getDataList();
    },

  },
}
</script>

